package com.agan.demo.controller;


import com.agan.demo.core.model.PaginateWithQueryColumns;
import com.agan.demo.dto.BaseResp;
import com.agan.demo.dto.ViewExecuteSql;
import com.agan.demo.service.ViewService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;


/**
 * @author cg
 * @title: ViewController
 * @description: TODO
 * @date 2020/7/27 9:27 AM
 */
@RestController
@RequestMapping(value = "/view")
@Api(value = "查询sql获取结果集",tags = "查询sql获取结果集")
@Slf4j
public class ViewController {

    @Autowired
    private ViewService viewService;

    /**
     * 查询sql获取结果集
     * @param viewExecuteSql
     * @return
     */
    @PostMapping(value = "/querySql")
    @ApiOperation(value = "查询sql获取结果集")
    public BaseResp<PaginateWithQueryColumns> querySql(@Valid @RequestBody ViewExecuteSql viewExecuteSql){
        return viewService.querySql(viewExecuteSql);
    }
}
